@extends('Admin.layout.layout')

@section('content')
	<div class="row">
		<div class="col-lg-12">
			<h1 class="page-header">用户修改</h1>
		</div>
		<!-- /.col-lg-12 -->
	</div>
	<div class="row">
        <div class="col-lg-6 col-lg-offset-3">
        	@if(session('error'))
        		{{session('error')}}
        	@endif

        	@if (count($errors) > 0)
				<div class="">
				    <ul>
				        @foreach ($errors->all() as $error)
				            <li>{{ $error }}</li>
				        @endforeach
				    </ul>
				</div>
			@endif
            <form role="form" action="{{url('/admin/user/update')}}" method="post" enctype="multipart/form-data">
                <div class="form-group">
                    <label>用户名</label>
                    <input class="form-control" type="text" name="username" value="{{$user->username}}">
                </div>
                <div class="form-group">
                    <label>邮箱</label>
                    <input class="form-control"  type="text" name="email" value="{{$user->email}}">
                </div>
                <div class="form-group">
                    <label>手机</label>
                    <input class="form-control" type="text" name="phone" value="{{$user->phone}}">
                </div>
                <div class="form-group">
                    <label>性别</label>
                    <div class="radio">
                        <label>
                            <input name="sex" value="1" type="radio" @if($user->sex == 1) checked="checked" @endif>男&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <input name="sex" value="2" type="radio" @if($user->sex == 2) checked="checked" @endif>女&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <input name="sex" value="3" type="radio" @if($user->sex == 3) checked="checked" @endif>保密
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label>学历</label>
                    <select class="form-control" name="edu">
                        <option value="1" @if($user->edu == 1) selected="selected" @endif>初中</option>
                        <option value="2" @if($user->edu == 2) selected="selected" @endif>高中</option>
                        <option value="3" @if($user->edu == 3) selected="selected" @endif>大专</option>
                        <option value="4" @if($user->edu == 4) selected="selected" @endif>本科</option>
                        <option value="5" @if($user->edu == 5) selected="selected" @endif>硕士</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>用户权限</label>
                    <select class="form-control" name="qx" id="qx">
                        <option value="1" @if($user->qx == 1) selected="selected" @endif>普通用户</option>
                        <option value="2" @if($user->qx == 2) selected="selected" @endif>管普通理员</option>
                        <option value="3" @if($user->qx == 3) selected="selected" @endif>超级管理员</option>
                    </select>
                </div>
                <div class="form-group">
                    <div style="position:relative;float:left">
                        <label>上传头像</label>
                        <input type="file" name="pic">
                    </div>
                    <div style="position:relative;float:left"> 
                        <img src="/upload/{{$user->pic}}" width="50px" height="50px">
                    </div>
                </div>
                <input type="hidden" name="id" value="{{$user->id}}">
                <input type="hidden" name="pic" value="{{$user->pic}}">
                {{ csrf_field() }}
            	<button class="btn btn-primary btn-lg btn-block">用户修改</button>
            </form>
        </div>
    </div>
@endsection